package com.zhl.spark.sbgl

import com.zhl.spark.core.BasicRdd

/**
 * @program: demos
 * @description: ${description}
 * @author: 刘振华
 * @create: 2020-12-15 18:00
 **/
object SqlHandle extends BasicRdd{
    def main(args: Array[String]): Unit = {
        test()
    }

    override def logic(): Unit = {
        val path = "D:\\work\\文档\\3.塔里木\\数据库\\sql\\all.sql"
        sc.textFile(path,1)
            .filter(line=>{
                !(line.startsWith("DROP TABLE") ||
                    line.contains("CONSTRAINT \"SYS") ||
                    line.startsWith("-- Checks structure"))
            })
            .map(_.replace(" \"TARIM\""," \"TARIM_UAT\"")
                    .replace("TARIM_DATA","TARIM_UAT")
                    .replace("\\","/"))
            .coalesce(1,true)
            .saveAsTextFile("D:\\work\\文档\\3.塔里木\\数据库\\sql\\rs")
    }
}
